//
//  PublicMethod.h
//  Kesetel_ios
//


#import <Foundation/Foundation.h>

@interface PublicMethod : NSObject

// MD5加密
/*
 *由于MD5加密是不可逆的,多用来进行验证
 */
// 32位小写
+(NSString *)MD5ForLower32Bate:(NSString *)str;
// 32位大写
+(NSString *)MD5ForUpper32Bate:(NSString *)str;
// 16为大写
+(NSString *)MD5ForUpper16Bate:(NSString *)str;
// 16位小写
+(NSString *)MD5ForLower16Bate:(NSString *)str;





/**
 获取两者之间
 @param percent percent description
 @param color1 color1 description
 @param color2 color2 description
 @return return value description
 */
+ (UIColor *)getColorOfPercent:(CGFloat)percent between:(UIColor *)color1 and:(UIColor *)color2;

/**
 *  无损图片体积压缩
 *  @param image 原图片
 *  @param newSize   要压缩到的图片大小
 *  @return 压缩后分辨率降低后的图像数据
 */
+ (UIImage *)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize;

/**
 *  图片截取
 *  @param image      image description
 *  @param mCGRect    mCGRect description
 *  @param centerBool centerBool description
 *  @return return value description
 */
+ (UIImage*)getSubImage:(UIImage *)image mCGRect:(CGRect)mCGRect centerBool:(BOOL)centerBool;

/**
 *  有损压缩图片数据大小
 *  @param originImage 原图片
 *  @param limitSize   要压缩到的数据大小
 *  @return 压缩后分辨率降低后的图像数据
 */
+ (NSData *)compressImage:(UIImage *)originImage
                     limitDataSize:(NSUInteger)limitSize;

/**
 *  上传图片压缩
 *  @param image image description
 *  @return return value description
 */
+ (UIImage *)compressByImage:(UIImage *)image;


/**
 设置圆形视图

 @param senter 视图
 */
+ (void)setCircularViewByView:(UIView *)senter;

/**
 *  存大图
 *  @param imageLists imageLists description
 */
+ (void)saveImageByImageLists:(NSMutableArray *)imageLists;

/**
 *  取图片从本地
 *  @return return value description
 */
+ (NSMutableArray *)readImageLocal;

//颜色数据
+ (UIColor *)colorFromHex:(NSString *)hex;

#pragma mark  系统判断 

///**
// * @brief     检查是否登陆
// * @return    YES已经登陆，NO为未登陆
// */
//+ (BOOL)checkIsLogin;
//
//
///**
// 是否使用流量
// */
//+ (BOOL)checkIsOpen4G;
//
//
///**
// 免打扰
// */
//+ (BOOL)checkIsDisturb;

/**
 * @brief     判断是否是合法的手机号码
 * @return    YES为合法，NO为不合法
 */
+ (BOOL)isValidateMobile:(NSString *)mobile;

/**
 判断是否合法的身份证

 @param userID 身份证号
 @return 返回是否合法
 */
+ (BOOL)checkUserID:(NSString *)userID;

/**
 银行卡格式验证

 @param bankCard 银行卡号
 @return 是否银行卡
 */
+ (BOOL)isBankCard:(NSString *)bankCard;

/**
 *  @brief  判断是否只是数字和小数点
 *  @return YES为是，NO为不是
 */
+ (BOOL)verifyTextFieldNumber:(NSString *)paramString;

//判断是否只包含特殊字符
+ (BOOL)stringContainSign:(NSString *)paramString;

//字符串转码成UTF-8
+ (NSString *)stringToUTF8:(NSString *)string;


/**
 判断输入文本是否纯中文

 @param string 文本
 @return 返回
 */
+ (BOOL) deptNameInputShouldChineseWith:(NSString *)string;

/**
 *  @brief  检测应用是否可以访问相册（相机）
 */
+ (BOOL)checkPhotoLibraryAuthorizationStatus;

+ (BOOL)checkCameraAuthorizationStatus;

/**
 *  //URL提取参数
 *
 *  @param query    URL Query String
 *  @param encoding 编码
 */
+ (NSDictionary *)dictionaryFromQuery:(NSString *)query
                        usingEncoding:(NSStringEncoding)encoding;


/**
 *  批量获取图片列表
 *
 *  @param imageArray imageArray description
 *
 *  @return return value description
 */
+ (NSMutableData *)getImagesDataByImagesArray:(NSMutableArray *)imageArray
                                   postParems: (NSMutableDictionary *)postParems;

/**
 label首行缩进
 
 @param label label
 @param emptylen 缩进比
 */
+ (void)dc_setUpLabel:(UILabel *)label content:(NSString *)content IndentationFortheFirstLineWith:(CGFloat)emptylen;



/**
 *  从缓存中拿取图片，如果没有则去异步下载
 *
 *  @param urlString      image url
 *  @param complelteBlock 完成block
 */
+ (void)downloadImageWithUrlString:(NSString *)urlString complete:(void(^)(UIImage *image))complelteBlock;

//抖动动画
+ (void)shakeAnimationForView:(UIView *)view
                  withXOffset:(CGFloat)xOffset
                      yOffset:(CGFloat)yOffset
                     duration:(CGFloat)duration
                   shakeCount:(NSInteger)shakeCount
                   completion:(void (^)(BOOL finished))completion;

//移动
+ (void)moveAnimationForView:(UIView *)view
                 withXOffset:(CGFloat)xOffset
                     duration:(CGFloat)duration
                  shakeCount:(NSInteger)shakeCount
                  completion:(void (^)(BOOL finished))completion;

+ (UIViewController *)getCurrentViewController;


+ (BOOL)isPad;
+ (NSString *)platformString;
+ (UIColor *)getColor:(NSString *)hexColor;
+ (NSString *)getShortVersionString;
+ (NSString *)getBuildVersionString;
+ (NSString *)getBuildVersionDebugContainTestString;
+ (NSString *)removeDecWith:(NSString *)str;
+ (NSString *)currentOSVersion;
+(NSString *)getMacAddress;
//+ (HKNetworkType)getNetworkTypeFromStatusBar;
+ (NSString *)getNetworkTypeStrFromStatusBar;
+ (NSString *)getSubscriberCellularProviderStr;
+ (NSString *)currentDeviceName;   //获取设备名称
+ (NSString *)deviceUUID;          //UUID
+ (NSString *)currentDeviceModel;  //手机型号
+ (NSString *)currentSystemName;   //系统名称

//获取某个日期是星期几
+ (NSString *)weekdayStringFromDate:(NSString *)dateString
                         dateFormat:(NSString *)dateFormat;

//对比时间戳
+ (NSString *)TimeCompareWith:(NSString *)dateFormat;


//时间转时间戳
+ (NSString *)timestampFromTimeString:(NSString *)timeStr;

//保留两位小数
+ (NSString *)keepTwoDecimalPoint:(NSString *)string;

//去掉最后一个字符
+ (NSString *)removeLastOneChar:(NSString*)origin;

//json转数组
+ (NSArray *)stringToJSON:(NSString *)jsonStr;

//数字精简
+ (NSString *)DigitalNumberWithString:(NSString *)numString;

//把手机号中间密文显示
+ (NSString *)phoneNumToAsterisk:(NSString*)phoneNum;
//把身份证中间密文显示
+ (NSString *)idCardToAsterisk:(NSString *)idCardNum;
//将银行卡中间密文显示
+ (NSString *)bankCardToAsterisk:(NSString *)idCardNum;

//根据银行卡号识别银行
+ (NSString *)getBankName:(NSString*)cardId;

@end
